<?php

if (isset($_GET["gethours"]) && isset($_GET["id"]))
{
	$sid = $_GET["id"];
	$QUERY = "
		SELECT SK.klas, S.uur, S.dag, S.week
		FROM studieuur S, studieuurklas SK
		WHERE SK.studieuur  = S.id
		AND S.id = $sid
	";
	////echo $QUERY;
	$resultheader = mysql_query($QUERY) or die (mysql_error());

	$QUERY = "
		SELECT uur, dag, week
		FROM studieuur
		WHERE id = $sid
	";
	////echo $QUERY;
	$resulttitle = mysql_query($QUERY) or die (mysql_error());

	
?><table cellspacing="0" align="left" valign="top">
	<tr>
		<td colspan="<?php print(mysql_numrows($resultheader)); ?>">
			<h1>Week <?php print(mysql_result($resulttitle, 0, "week")); ?>,  <?php print(mysql_result($resulttitle, 0, "dag")); ?><?php print(mysql_result($resulttitle, 0, "uur")); ?>: <input id="reloadGethours_id" type="text" value="alle klassen" style="color: gray;" onfocus="if (this.value == 'alle klassen') { this.value = ''; this.style.color = 'black'; }" onblur="if (this.value == '') { this.value = 'alle klassen'; this.style.color = 'gray'; }" onkeyup="if (enter_was_pressed(event)) { reloadGethours_id(); }" /></h1>
		</td>
	</tr>
	<tr style="vertical-align: top;">
		<td id="gethours_id">
<?php


require("gethours_id.php");
	
	
?>		</td>
	</tr>
</table>
<?php


}

if (isset($_GET["gethours"]) && isset($_GET["week"]))
{
	$week = $_GET["week"];
	$QUERY = "
		SELECT COUNT( DISTINCT S.id ) AS colspan
		FROM studieuur S, studieuurklas SK
		WHERE SK.studieuur  = S.id
		AND S.week = '$week'
	";
	////echo $QUERY;
	$resultcolspan = mysql_query($QUERY);
	$columns = mysql_result($resultcolspan, 0, "colspan");


?><table cellspacing="0" align="left" valign="top">
	<tr>
		<td colspan="<?php print("$columns"); ?>">
			<h1>Week <?php print("$week"); ?>: <input id="reloadGethours_week" type="text" value="alle uren" style="color: gray;" onfocus="if (this.value == 'alle uren') { this.value = ''; this.style.color = 'black'; }" onblur="if (this.value == '') { this.value = 'alle uren'; this.style.color = 'gray'; }" onkeyup="if (enter_was_pressed(event)) { reloadGethours_week(); }" /></h1>
		</td>
	</tr>
	<tr>
		<td id="gethours_week">
<?php



require("gethours_week.php");
	
	
	
?>		</td>
	</tr>
</table>


<?php

mysql_close();

?>